package com.project.bean;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Arrays;
import java.util.List;

/**
 * 用户实体类
 */
@Data
@NoArgsConstructor
@TableName("t_user")
public class UserBean {
    @TableId(value = "pk_userId",type = IdType.AUTO)
    private Integer id;

    @TableField("u_name")
    private String name;

    @TableField("u_pwd")
    private String pwd="123";

    @TableField("u_realName")
    private String realName;
    /**
     * 员工状态（在职/离职）
     */
    @TableField("u_status")
    private String status="在职";

    /**
     * 盐
     */
    @TableField("u_salt")
    private String salt;
    /**
     * 角色用户
     */
    @TableField(exist = false)
    private List<RoleBean> roleList;

    @TableField(exist = false)
    private Integer[] roleIdList;

    @TableField(exist = false)
    private List<PermissionBean> permissionList;
    @TableField(exist = false)
    private List<Integer> limitList;



    public UserBean(String name, String realName) {
        this.name = name;
        this.realName = realName;
    }

    @Override
    public String   toString() {
        return "UserBean{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", pwd='" + pwd + '\'' +
                ", realName='" + realName + '\'' +
                ", status='" + status + '\'' +
                ", roleList=" + roleList +
                ", roleIdList=" + Arrays.toString(roleIdList) +
                ", permissionList=" + permissionList +
                ", limitList=" + limitList +
                ", salt='" + salt + '\'' +
                '}';
    }
}
